Skip to content

Update plugin 进程端口管理 v1.0.1#297

Merged
lzx8589561 merged 1 commit into
ZToolsCenter:mainfrom
Code-Agitator:plugin/process-manager
Jul 8, 2026
Merged

Update plugin 进程端口管理 v1.0.1#297
lzx8589561 merged 1 commit into
ZToolsCenter:mainfrom
Code-Agitator:plugin/process-manager

Conversation

@Code-Agitator

@Code-Agitator Code-Agitator commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

插件信息

  • 名称: 进程端口管理
  • 插件ID: process-manager
  • 版本: 1.0.1
  • 描述: 快速搜索进程、端口、PID、路径,支持一键 Kill 进程,支持深色模式
  • 作者: Agitator
  • 类型: 更新

本次变更

🐛 修复

  • 中文路径乱码 — 使用 iconv-lite 将 wmic 输出的 GBK 编码转换为 UTF-8,修复中文 Windows 下进程路径显示乱码的问题

🧹 优化

  • 移除 App.tsx 中未使用的 route state
  • 统一 CACHE_TTL 常量定义,消除重复代码

截图 / 演示

自检清单

  • plugin.json 的 name / title / version / description / author 字段均已检查
  • 已移除调试日志、未使用文件、敏感信息(.env、token、密钥等)
  • 本次 PR 的 diff 仅涉及 plugins/process-manager/ 目录
  • 已在本地 ZTools 客户端实际加载并测试过此插件,主要功能正常
  • 同意以仓库声明的开源协议发布此插件

此 PR 由 ztools-plugin-cli 自动管理:每次 ztools publish 在分支上追加一个 commit,PR 链接保持不变。

- feat: process port manager plugin - search processes by PID/port/name/path, kill with one click
- chore: add plugin description
- chore: readme
- feat: 使用 react-icons 库替换文本字符图标
- style: 自定义滚动条样式匹配主窗体风格
- feat: 将 Kill 确认弹窗改为页面级别模态框
- chore: readme
- style: 将主容器背景设为全透明
- fix: 修复透明背景下的颜色协调问题
- fix: 修复 hover 高亮边距不一致问题
- fix: 确保 pm-body 占满全部宽度
- fix: 修复滚动条与背景融合问题
- fix: 仅修改滚动条颜色不改变背景
- feat: 替换 logo 为 SVG 格式,更新截图和插件配置
- docs: 在 README 中展示 logo
- docs: 添加 MIT 协议文件
- docs: 添加与常见进程管理工具的对比优势
- docs: 简化优势描述为纯要点
- feat: 移除 Kill 按钮,改为右键直接 Kill,结果提示移至顶部
- feat: 右键弹出确认弹窗后再 Kill
- feat: 顶部改为操作提示「右键可 Kill 进程」,Kill 结果用 toast
- fix: 修复 JSX 结构导致的构建报错
- fix: 缩短弹窗动画时间,消除右键弹窗延迟感
- optimize: 优化界面和文档
- optimize: 优化文档
- chore: 填充作者信息
- optimize: 优化命令注入安全问题
- docs: CHANGELOG.md
- optimize: improve process management UX and search sorting
- fix: 搜索逻辑改为字符串模糊匹配,支持 PID/端口部分匹配
- ci: add release workflow
- ci: add tag input for workflow_dispatch
- ci: read version from package.json
- ci: fix quote nesting for node -p
- fix: pnpm run build fail
- fix: 修复进程路径中文乱码 + 清理死代码
- chore: bump version to 1.0.1 + update changelog

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the process manager plugin to version 1.0.1, addressing Chinese path encoding issues on Windows by decoding command output with gbk via iconv-lite. It also removes unused route state in App.tsx and unifies the CACHE_TTL constant definition. Feedback on these changes suggests a more portable approach to handle Windows encoding: prefixing commands with chcp 65001 to force UTF-8 output, which allows using native utf8 decoding and avoids introducing the iconv-lite dependency entirely.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +3 to 11
const iconv = require('iconv-lite')

function execAsync(cmd, timeout) {
return new Promise((resolve) => {
exec(cmd, { timeout }, (err, stdout) => {
resolve(err ? '' : stdout)
exec(cmd, { timeout, encoding: 'buffer' }, (err, stdout) => {
resolve(err ? '' : iconv.decode(stdout, 'gbk'))
})
})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

硬编码 gbk 编码会导致在非简体中文 Windows 系统(如繁体中文、日文、韩文或英文系统)下,如果进程路径或名称包含非 ASCII 字符,解码时会出现乱码。\n\n更优雅且通用的解决方案是在 Windows 下执行命令前先通过 chcp 65001 将控制台编码切换为 UTF-8,这样可以直接使用 Node.js 默认的 utf8 编码进行解析,不仅能完美支持所有语言系统,还能避免引入第三方依赖 iconv-lite

function execAsync(cmd, timeout) {
  return new Promise((resolve) => {
    const formattedCmd = process.platform === 'win32' ? 'chcp 65001 > nul && ' + cmd : cmd
    exec(formattedCmd, { timeout, encoding: 'utf8' }, (err, stdout) => {
      resolve(err ? '' : stdout)
    })
  })
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个无法处理 wmic的输出

Comment on lines +13 to 14
"iconv-lite": "^0.7.3",
"react": "^19.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

由于我们在 services.js 中通过 chcp 65001 解决了乱码问题,不再需要 iconv-lite 依赖,可以将其从 dependencies 中移除。

Suggested change
"iconv-lite": "^0.7.3",
"react": "^19.0.0",
"react": "^19.0.0",

@Code-Agitator Code-Agitator marked this pull request as ready for review July 8, 2026 02:01
@lzx8589561 lzx8589561 merged commit ce54b89 into ZToolsCenter:main Jul 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants